package rest.o.gram.lean;

import com.google.gson.annotations.SerializedName;

import java.io.Serializable;
import java.util.Map;

public class LeanAccount implements Serializable {

    @SerializedName("id")
    public long id = 0;

    @SerializedName("nickName")
    public String nickName;

    @SerializedName("providerId")
    public String providerId;

    @SerializedName("provider")
    public String provider;

    @SerializedName("providerProperties")
    public Map<String, Object> providerProperties;

    public LeanAccount(long id, String nickName, String providerId, String provider, Map<String, Object> providerProperties) {
        this.id = id;
        this.nickName = nickName;
        this.providerId = providerId;
        this.provider = provider;
        this.providerProperties = providerProperties;
    }

    /**
     * Returns the internal Id of the account. Account Id is server generated and is unique per account.
     *
     * @return Id of the account.
     */
    public Long getId() {
        return id;
    }

    /**
     * User ID as provided by authentication provider. Ids are guaranteed to be unique within provider,
     * but not across different providers.
     * @return User ID generated by authentication provider.
     */
    public String getProviderId() {
        return providerId;
    }

    /**
     * Returns the identification string of authentication provider that authenticated this account.
     * <br/><br/>
     * Identification string may contain only provider unique string, e.g. {@code 'fb-oauth'} for Facebook,
     * or it might contain full URL including user identification, e.g.
     * {@code 'https://www.google.com/accounts/o8/id?id=user_id_hash'} in case of Google OpenID.
     *
     * @return Provider authentication string.
     */
    public String getProvider() {
        return provider;
    }

    /**
     * Nickname of the user represented by this account. Format is provider dependent.
     * Some providers use email as nick name.
     * @return Nickname.
     */
    public String getNickName() {
        return nickName;
    }

    /**
     * Returns provider-dependent map of user properties.
     * This may contain data such as gender, first name, last name, etc..
     * @return Map of properties.
     */
    public Map<String, Object> getProviderProperties() {
        return providerProperties;
    }
}
